Have anyone got similar issue. If yes then what is the solution you are using for this, please let us know..
Post
Replies
Boosts
Views
Activity
Thank you so much.This has worked for me..
Hello,Earlier I tried to save .csv file usingfunc getDownloadsDirectory() -> NSString { let paths = NSSearchPathForDirectoriesInDomains(.downloadsDirectory, .userDomainMask, true) let documentsDirectory = paths[0] return documentsDirectory as NSString}let filePath = BaseViewController.getDownloadssDirectory().appendingPathComponent("WalletTransactions.csv")decodeData.write(toFile: filePath, atomically: true)let str = String(decoding: decodeData, as: UTF8.self) let vc = UIActivityViewController(activityItems: [str], applicationActivities: []) vc.excludedActivityTypes = [ UIActivity.ActivityType.assignToContact, UIActivity.ActivityType.saveToCameraRoll, UIActivity.ActivityType.postToFlickr, UIActivity.ActivityType.postToVimeo, UIActivity.ActivityType.postToTencentWeibo, UIActivity.ActivityType.postToTwitter, UIActivity.ActivityType.postToFacebook, UIActivity.ActivityType.openInIBooks ] self.present(vc, animated: true, completion: nil)But I want to download file in user's iphone, so that user can locate there .csv file in Files App of iPhone.Using above code file was not saved in Files App of iPhone.So, can you please look into it.Also for my first question How can I change the extension of file.Using:let str = String(decoding: decodeData, as: UTF8.self) let vc = UIActivityViewController(activityItems: [str], applicationActivities: [])File is getting downloaded in .txt file.Is there any way to remove this str before opening UiActivityController.
Hi Claude31,I am sharing the code with I am using for Document picker.let picker = UIDocumentPickerViewController.init(documentTypes: [".pdf", ".png", ".jpeg", ".jpg"], in: .open) let picker = UIDocumentPickerViewController(documentTypes: ["public.pdf"], in: .open) picker.delegate = self picker.modalPresentationStyle = .fullScreen self.present(picker, animated: true, completion: nil)Even one more issue is occuring:let icloudFolderURL:- FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents").icloudFolderURL returns nil to me.
Thank you.